}
}
+ pub fn is_cdylib(&self) -> bool {
+ let libs = match self.kind {
+ TargetKind::Lib(ref libs) => libs,
+ _ => return false
+ };
+ libs.iter().any(|l| {
+ match *l {
+ LibKind::Other(ref s) => s == "cdylib",
+ _ => false,
+ }
+ })
+ }
+
pub fn linkable(&self) -> bool {
match self.kind {
TargetKind::Lib(ref kinds) => {
// just here for rustbuild. We need a more principled method
// doing this eventually.
if !unit.profile.test &&
- unit.target.is_dylib() &&
+ (unit.target.is_dylib() || unit.target.is_cdylib()) &&
unit.pkg.package_id().source_id().is_path() &&
!env::var("__CARGO_DEFAULT_LIB_METADATA").is_ok() {
return None;
let mut rustflags = Vec::new();
let name = name.chars().flat_map(|c| c.to_lowercase()).collect::<String>();
- // Then the target.*.rustflags value...
+ // Then the target.*.rustflags value...
let target = build_config.requested_target.as_ref().unwrap_or(&build_config.host_triple);
let key = format!("target.{}.{}", target, name);
if let Some(args) = config.get_list_or_split_string(&key)? {
"[RUNNING] `/usr/bin/env rustc --crate-name foo [..]")
.with_status(0));
}
+
+#[test]
+fn cdylib_not_lifted() {
+ let p = project("foo")
+ .file("Cargo.toml", r#"
+ [project]
+ name = "foo"
+ authors = []
+ version = "0.1.0"
+
+ [lib]
+ crate-type = ["cdylib"]
+ "#)
+ .file("src/lib.rs", "");
+
+ assert_that(p.cargo_process("build"), execs().with_status(0));
+
+ let files = if cfg!(windows) {
+ vec!["foo.dll.lib", "foo.dll.exp", "foo.dll"]
+ } else if cfg!(target_os = "macos") {
+ vec!["libfoo.dylib"]
+ } else {
+ vec!["libfoo.so"]
+ };
+
+ for file in files {
+ println!("checking: {}", file);
+ assert_that(&p.root().join("target/debug/deps").join(&file),
+ existing_file());
+ }
+}